package de.slash.jplaylistextractor.model;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.File;
import java.util.ArrayList;

/**
 * User: Slash
 * Date: 24.02.2012
 * Time: 14:59
 */
@XmlRootElement(name = "smil")
public class WplPlaylist
{
    private Head head;
    private Body body;

    @XmlElement(name = "head")
    public Head getHead()
    {
        return head;
    }

    public void setHead(Head head)
    {
        this.head = head;
    }

    @XmlElement(name = "body")
    public Body getBody()
    {
        return body;
    }

    public void setBody(Body body)
    {
        this.body = body;
    }

    public static class Head
    {
        private ArrayList<Meta> metas;
        private String title;

        @XmlElement(name = "meta")
        public ArrayList<Meta> getMetas()
        {
            return metas;
        }

        public void setMetas(ArrayList<Meta> metas)
        {
            this.metas = metas;
        }

        @XmlElement(name = "title")
        public String getTitle()
        {
            return title;
        }

        public void setTitle(String title)
        {
            this.title = title;
        }
    }

    public static class Meta
    {
        private String name;
        private String content;

        @XmlAttribute(name = "name")
        public String getName()
        {
            return name;
        }

        public void setName(String name)
        {
            this.name = name;
        }

        @XmlAttribute(name = "content")
        public String getContent()
        {
            return content;
        }

        public void setContent(String content)
        {
            this.content = content;
        }
    }

    public static class Body
    {
        private Seq seq;

        @XmlElement(name = "seq")
        public Seq getSeq()
        {
            return seq;
        }

        public void setSeq(Seq seq)
        {
            this.seq = seq;
        }
    }

    public static class Seq
    {
        private ArrayList<Media> medias;

        @XmlElement(name = "media")
        public ArrayList<Media> getMedias()
        {
            return medias;
        }

        public void setMedias(ArrayList<Media> medias)
        {
            this.medias = medias;
        }
    }

    public static class Media
    {
        private String src;

        @XmlAttribute(name = "src")
        public String getSrc()
        {
            return src;
        }

        public void setSrc(String src)
        {
            this.src = src;
        }

        public String toString()
        {
            File mediaFile = new File(src);
            return mediaFile.getName();
        }
    }
}
